package com.example.bidding_agency_charge_backend.model.enums;

import org.apache.commons.lang3.StringUtils;


public enum ProcessEnum {
    GOODS("goods", "货物招标"),
    SERVICE("service", "服务招标"),
    PROJECT("project", "工程招标");

    private final String text;

    private final String value;

    ProcessEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param value
     * @return
     */
    public static ProcessEnum getEnumByValue(String value) {
        if (StringUtils.isEmpty(value)) {
            return null;
        }
        for (ProcessEnum anEnum : ProcessEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }

    public String getText() {
        return text;
    }
}
